import './App.scss'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import Login from './pages/Login'
import Layout from './pages/Layout'
import ProfileEdit from './pages/Mine/Edit'
import PrivateRoute from './components/AuthRoute'
import history from './utils/history'
import Chat from './pages/Mine/Chat'
import Article from './pages/Article'
import SearchPage from './pages/Search'
import Result from './pages/Search/Result'

function App() {
  return (
    <Router history={history}>
      <div className="App">
        <Switch>
          <Redirect exact from="/" to="/home"></Redirect>
          <Route path="/login" component={Login}></Route>
          <Route path="/home">
            <Layout></Layout>
          </Route>
          {/* <Route path="/profile/edit" component={ProfileEdit}></Route> */}
          <PrivateRoute path="/profile/edit">
            <ProfileEdit></ProfileEdit>
          </PrivateRoute>
          <PrivateRoute path="/chat">
            <Chat></Chat>
          </PrivateRoute>
          <Route path="/article/:id">
            <Article></Article>
          </Route>
          <Route exact path="/search">
            <SearchPage></SearchPage>
          </Route>
          <Route path="/search/result">
            <Result></Result>
          </Route>
        </Switch>
      </div>
    </Router>
  )
}

export default App
